Configuring the ZK Configuration File

From Documentation


Configuring the ZK Configuration File


Stop.png This documentation is for an older version of ZK. For the latest one, please click here.


To make ZK works with Hibernate smoothly, you have to use the following utilities.

  1. Create zk.xml under $myApp/WEB-INF/(if not exists)
  2. Copy the following lines into your zk.xml
 <!-- Hibernate SessionFactory lifecycle -->
 <listener>
 <description>Hibernate SessionFactory lifecycle</description>
 <listener-class>org.zkoss.zkplus.hibernate.HibernateSessionFactoryListener</listener-class>
 </listener>

 <!-- Hibernate OpenSessionInView Pattern -->
 <listener>
 <description>Hibernate Open Session In View life-cycle</description>
 <listener-class>org.zkoss.zkplus.hibernate.OpenSessionInViewListener</listener-class>
 </listener>

 <!-- Hibernate thread session context handler -->
 <listener>
 <description>Hibernate thread session context handler</description>
 <listener-class>org.zkoss.zkplus.hibernate.HibernateSessionContextListener</listener-class>
 </listener>

$myApp represents the name of your web application. ex. event



Last Update : 2022/01/19

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.